package com.zzy.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzy.system.domain.PurchaseInStockOrderDetailItem;
import com.zzy.system.mapper.PurchaseInStockOrderDetailItemMapper;
import com.zzy.system.service.IPurchaseInStocklOrderDetailitemService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PurchaseInStockOrderDetailitemServiceImpl extends ServiceImpl<PurchaseInStockOrderDetailItemMapper, PurchaseInStockOrderDetailItem> implements IPurchaseInStocklOrderDetailitemService {
    private static final Logger log = LoggerFactory.getLogger(PurchaseInStockOrderDetailitemServiceImpl.class);

    @Override
    public void saveBatchList(List<PurchaseInStockOrderDetailItem> purchaseInStockOrderDetailItemList) {
        if(!purchaseInStockOrderDetailItemList.isEmpty()){
            QueryWrapper<PurchaseInStockOrderDetailItem> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("in_stock_sheet_id", purchaseInStockOrderDetailItemList.get(0).getInStockSheetId());
            baseMapper.delete(queryWrapper);
            this.saveBatch(purchaseInStockOrderDetailItemList);
        }


    }
}